<?php
// TODO: pom    澳买拼团 逻辑处理
namespace Home\Common\Api;

class Index
{

    // TODO: 获取最近图片
    public function lately_img()
    {
 
         $where['u_id'] = $_SESSION['user_id'];
         $where['is_activity'] =1;
         $list = D('images')->where($where)->limit(0,16)->order('id  desc')->select();
         if($list){
           return $list;
         }
    }

    // TODO: 获取聊天记录
    public function chat_data($start_time,$end_time)
    {
         $where['createtime'] = array('between',array($start_time,$end_time));
         $list = D('chat')->where($where)->order('id  asc')->select();
         if($list){
           return $list;
         }
    }
    // TODO: 将图片路径保存数据库
    public function insert_images($data)
    {
      $data['u_id'] = $_SESSION['users']['id'];
      $data['addtime'] = date('Y-m-d H:i:s');
      $data['sort'] = 0;
      $data['type_id'] = '';
      $data['title'] = '';
      $data['content'] = '';
      $data['happen_time'] = 0;
      $data['is_activity'] = 1;
      $data['raw_url'] = $data['url'];
      $data['compress_url'] = $data['thumb_url'];
      unset($data['url']);
      unset($data['thumb_url']);
      $res = D('images')->add($data);
      if($res){
            return $res;
      }
    }

















}






?>
